package com.bjt.wms.sys.service;

import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.bjt.wms.sys.model.AccessDetail;
import com.bjt.utils.R;

/**
 * @author WenbinJi
 */
public class AccessDetailService {

    /**
     * 新增刷卡记录
     */
    public R add(JSONObject jsonObject) {
        AccessDetail accessDetail = new AccessDetail();
        accessDetail.setEmployeeId(jsonObject.getInteger("employee_id"));
        accessDetail.setWarehouseId(jsonObject.getInteger("warehouse_id"));
        accessDetail.setCreateTime(DateUtil.date().toString("yyyy-MM-dd hh:mm:ss"));
        accessDetail.setImgUrl(jsonObject.getString("image_id"));
        return accessDetail.save() ? R.ok() : R.error();
    }
}